{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2500\n"
     ]
    }
   ],
   "source": [
    "sum=0\n",
    "n=1\n",
    "while n<101:\n",
    "           sum=sum+n\n",
    "           n=n+2\n",
    "print(sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-9-00dfb520dc12>, line 4)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-9-00dfb520dc12>\"\u001b[1;36m, line \u001b[1;32m4\u001b[0m\n\u001b[1;33m    if x&1=1:\u001b[0m\n\u001b[1;37m          ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "a=1\n",
    "b=1\n",
    "for x in range(2,21,2):\n",
    "    if x&1=1:\n",
    "             a=a*x\n",
    "        \n",
    "    if x&1=0:\n",
    "             b=b*x\n",
    "        \n",
    "print(a,b)\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "185794560\n",
      "654729075\n"
     ]
    }
   ],
   "source": [
    "a=1\n",
    "b=1\n",
    "n=2\n",
    "while n<20:\n",
    "    a=a*n\n",
    "    n=n+2\n",
    "print(a)\n",
    "for x in range(1,20,2):\n",
    "    b=b*x\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def f(a,b,c):\n",
    "    delta=(b**2)-4*a*c\n",
    "    if delta<0:\n",
    "        return ['无解']\n",
    "    else:\n",
    "        return[-b+(b**2-4*a*c)**0.5)/2*a,(-b-(b**2-4*a*c)**0.5)/(2*a)]\n",
    "print(f(a,b,c))\n",
    "    \n",
    "        \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def qua(a,b,c):\n",
    "    if b**2-4*a*c<0:\n",
    "        return(\"无解\")\n",
    "    else:\n",
    "        x1=(-1*b+(b**2-4*a*c))/(2*a)\n",
    "        x2=(-1*b-(b**2-4*a*c))/(2*a)\n",
    "        return([str(x1),str(x2)])\n",
    "print(qua(float(input(\"a=\")),float(input(\"b=\")),float(input(\"c=\"))))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
